//
//  LSmainViewController.swift
//  新浪微博
//
//  Created by 梁森 on 16/6/25.
//  Copyright © 2016年 梁森. All rights reserved.
//

import UIKit

class LSmainViewController: UITabBarController {
    
    
    override func viewDidLoad() {
        
        let tab = LSTabBar()
        tab.lsDelegate = self
        
        setValue(tab, forKey: "tabBar")
        super.viewDidLoad()
        addChildController(LSHomeTableViewController(), title: "首页", imageName: "tabbar_home")
        addChildController(LSMessageTableViewController(), title: "信息", imageName: "tabbar_message_center")
        addChildController(LSDiscoverTableViewController(), title: "发现", imageName: "tabbar_discover")
        addChildController(LSprofileTableViewController(), title: "我的", imageName: "tabbar_profile")
    }
    
    func addChildController(vc: UIViewController,title:String,imageName:String) {
        vc.title = title
        vc.tabBarItem.image = UIImage(named: imageName)
        vc.tabBarItem.selectedImage = UIImage(named:"\(imageName)_selected")
        let nav = UINavigationController(rootViewController: vc)
        addChildViewController(nav)
    }
}
extension LSmainViewController:LSDelegate{
    func composehahaClick() {
        print("哈哈")
    }
}
